
#include "typedef.h"
#include "Os.h"

tSleep mSleep = 0;

Queue			g_MmcToCmQueue;
BusDataPacket	g_MmcToCmQueueBuff[MAX_BUS_DATAPACKET];

Queue			g_CmToMmcQueue;
BusDataPacket	g_CmToMmcQueueBuff[MAX_BUS_DATAPACKET];

Queue			g_LocalQueue;
BusDataPacket	g_LocalQueueBuff[MAX_BUS_DATAPACKET];

IicDriver g_MmcIpmbLIicDriver;
IicDriver g_IicDriverLocal;


void Hw_Init()
{
	g_Owerner_IPMB_Addr = 0x72;

	QUEUE_init(&g_MmcToCmQueue	, (uint8*)&g_MmcToCmQueueBuff	, sizeof(BusDataPacket)	, MAX_BUS_DATAPACKET);
	QUEUE_init(&g_CmToMmcQueue	, (uint8*)&g_CmToMmcQueueBuff	, sizeof(BusDataPacket)	, MAX_BUS_DATAPACKET);
	QUEUE_init(&g_LocalQueue	, (uint8*)&g_LocalQueueBuff		, sizeof(BusDataPacket)	, MAX_BUS_DATAPACKET);

	IicDriverTester_Init(&g_IicDriverLocal, 1, &g_LocalQueue, &g_LocalQueue, Null, Null);
	IicDriverTester_Init(&g_MmcIpmbLIicDriver, 0, &g_CmToMmcQueue, &g_MmcToCmQueue, Null, Null);

	memset(g_FruDeviceBuffer, 0, sizeof(g_FruDeviceBuffer));
}

unsigned int sleep (unsigned int ticks)
{
	if(mSleep)
	{
		mSleep(ticks);
	}
	return 0;
}

void microblaze_enable_interrupts(void)
{
}
void microblaze_disable_interrupts(void)
{
}

void enable_interrupt(int nValue)
{
}

int register_int_handler(int id,void * p1,void* p2)
{
	return 0;
}

uint8 DriverEk_GetState(uint8 IicAddr)
{
	return 0;
}

Bool DriverEk_SetState(uint8 IicAddr, uint8 state)
{
	return 0;
}

/*

void* memset(void* pData, int value, int len)
{
	int i = 0;
	uint8* pUint8 = (uint8*)pData;

	for(i = 0; i < len; i++, pUint8++)
	{
		*pUint8 = value;
	}

	return pData;
}

void* memcpy(void* pDest, const void* pSrc, int len)
{
	int i = 0;

	for(i = 0; i < len; i++)
	{
		*((uint8*)pDest)++ = *((uint8*)pSrc)++;
	}

	return pDest;
}

int memcmp(void* pDest, const void* pSrc, int len)
{
	return 0;
}
*/